package com.easyj.admin.sys.service;

import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.easyj.admin.db.model.Department;
import com.easyj.admin.db.model.ImpResult;
import com.easyj.base.common.vo.tree.TreeNode;
import com.easyj.base.exception.ValidateException;

public interface DepartmentService {
	/**
	 * 取得组织树
	 * @return
	 */
	public List<TreeNode> getTree(boolean onlyComapny);
	
	public List<TreeNode> getAllTree();
	/**
   	 * 按权限限定的树
   	 * @return
   	 */
	public List<TreeNode> getLimitTree(List<Long> limitIds,boolean onlyComapny);
	
	/**
   	 * 后代树，withSelf 是否包含自已
   	 * @param parentId
   	 * @param withSelf 是否包含自已
   	 * @return
   	 */
	public List<TreeNode> getDesendantTree(Long deptId,boolean withSelf);

   	public List<Department> findList(Department filter);

	public Department findById(Long id);
	
	public Department selectUniqueByUnique(String code);

	public int  insertEntity(Department entity)throws ValidateException;
	public int  updateEntity(Department entity) throws ValidateException;

	public int  deleteById(Long id,Long operatorId);
	
	public int  disabledById(Long id,Long operatorId);
	
	public int  enableById(Long id,Long operatorId);
	
	/**
   	 * 返回所有下级Id和及自己Id,没有返回null; deleted=false,表示只返回正常的，不包含停用的
   	 * @param id
   	 * @return
   	 */
   	public List<Long> getDesendantIds(Long id,boolean deleted);
   	
   	public List<Long> getDesendantCompanyIds(Long id);
   	
   	public int  changeParent(Long id,Long parentId,Long operatorId) throws ValidateException;
   	
   	public ImpResult importExcel(MultipartFile excelfile,Long operatorId) throws Exception;
   	
 	/**
 	 * 有权限管理的公司，折旧使用
 	 * @param limitIds
 	 * @return
 	 */
   	public List<Department> getPermCompanys(List<Long> limitIds);
   	
   	
}
